#include "dominion.h"
#include "dominion_helpers.h"
#include <string.h>
#include <stdio.h>
#include <assert.h>
#include <math.h>
#include <stdlib.h>
#include "rngs.h"
#define NEWCC 26

//Oracle
int checksmithy(struct gameState *post) {
        struct gameState pre;
        memcpy(&pre, post, sizeof(struct gameState));
        int r;
        int handPos;
        int *bonus = 0;

        r=(int)(floor(Random() * 10));
        handPos = (r <= 1) ? (post->handCount[post->whoseTurn] - 1) : (floor(Random() * post->handCount[post->whoseTurn]));
        r=cardEffect(smithy, 0, 0, 0, post, handPos, bonus);
        int i;
        for (i = 0; i < 3; i++) {
        	drawCard(pre.whoseTurn, &pre);
        }
        discardCard(handPos, pre.whoseTurn, &pre, 0);
        if (r != 0 || memcmp(&pre, post, sizeof(struct gameState)) != 0) {return -1;}
        return 0;
}
//main
int main() {
        int i, j, n, r, player;
        struct gameState G;
        SelectStream(2);
        PutSeed(3);

        printf("smithy Tests\n");
        for (n = 0; n < 2000; n++) {
                for (i = 0; i < sizeof(struct gameState); i++) {
                        ((char*) &G)[i] = floor(Random() * 256);
                }
                player = floor(Random() * 2) + 2;
                for (i = 0; i <= player; i++) {
                        G.deckCount[i]    = floor(Random()*500);
                        G.discardCount[i] = floor(Random()*500);
                        G.handCount[i]    = floor(Random()*500);
                        }
                }
              
 
              printf("Passed\n");
              return 0;
}